package com.server.pinggu.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.server.pinggu.mapper.SenActionlogMapper;
import com.server.pinggu.domain.SenActionlog;
import com.server.pinggu.service.ISenActionlogService;

import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author ltao
 * @date 2022-10-23
 */
@Service
public class SenActionlogServiceImpl extends ServiceImpl<SenActionlogMapper, SenActionlog> implements ISenActionlogService {

    @Override
    public List<SenActionlog> queryList(SenActionlog senActionlog) {
        LambdaQueryWrapper<SenActionlog> lqw = Wrappers.lambdaQuery();
        lqw.select(SenActionlog::getUname,SenActionlog::getDtime,SenActionlog::getTag);
        if (senActionlog.getUid() != null){
            lqw.eq(SenActionlog::getUid ,senActionlog.getUid());
        }
        if (StringUtils.isNotBlank(senActionlog.getUname())){
            lqw.like(SenActionlog::getUname ,senActionlog.getUname());
        }
        if (senActionlog.getFormid() != null){
            lqw.eq(SenActionlog::getFormid ,senActionlog.getFormid());
        }
        if (StringUtils.isNotBlank(senActionlog.getTag())){
            lqw.eq(SenActionlog::getTag ,senActionlog.getTag());
        }
        if (senActionlog.getDtime() != null){
            lqw.eq(SenActionlog::getDtime ,senActionlog.getDtime());
        }
        if (StringUtils.isNotBlank(senActionlog.getP())){
            lqw.eq(SenActionlog::getP ,senActionlog.getP());
        }
        lqw.orderByDesc(SenActionlog::getId);
        return this.list(lqw);
    }
}